//
//  ANCSViewController.m
//  VidoarDemo
//
//  Created by xm on 2025/7/28.
//

#import "ANCSViewController.h"
#import "ConsumerViewController.h"
#import "ProviderViewController.h"

@interface ANCSViewController ()

@property(nonatomic, strong) UIButton *providerButton;
@property(nonatomic, strong) UIButton *consumerButton;


@end

@implementation ANCSViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setup];
}


#pragma mark - intt

-(void) setup
{
    [self createdUI];
    [self watch];

}

-(void) createdUI
{
    [self.view addSubview:self.providerButton];
    [self.view addSubview:self.consumerButton];
}
-(void) watch
{
    [[self.providerButton rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [self goProviderPageAction];
       
    }];
    
    [[self.consumerButton rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [self goConsumerPageAction];
       
    }];
    
}
    
#pragma mark - getter

- (UIButton *)providerButton
{
    if(_providerButton){
        return _providerButton;
    }
    
    CGRect frame = CGRectMake(20, NavAndStatusToolHeight + 20, screenWidth - 40, 48);
    UIButton* button = [UIViewHelper createButtonWithTitle:@"Notification Provider" frame:frame];
    
    _providerButton = button;
    return _providerButton;
}

- (UIButton *)consumerButton
{
    if(_consumerButton){
        return _consumerButton;
    }
    
    CGRect frame = CGRectMake(20, self.providerButton.bottom + 30, self.providerButton.width, 48);
    UIButton* button = [UIViewHelper createButtonWithTitle:@"Notification Consumer" frame:frame];
    
    _consumerButton = button;
    return _consumerButton;
}

#pragma mark - actions

-(void) goProviderPageAction
{
    UIViewController* vc = [[ProviderViewController alloc ] init];
    
    [self.navigationController pushViewController:vc animated:YES];
}

-(void) goConsumerPageAction
{
    UIViewController* vc = [[ConsumerViewController alloc ] init];
    
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - motheds




@end
